package com.lucenewapper.search;

import java.util.ArrayList;
import java.util.List;

public class SearchResult<T extends Searchable> {

	private long totalCount;
	private List<T> datas = new ArrayList<T>();
	private int pageSize = 30;

	public long getTotalCount() {
		return totalCount;
	}

	public void setTotalCount(long totalCount) {
		this.totalCount = totalCount;
	}

	public List<T> getDatas() {
		return datas;
	}

	public void setDatas(List<T> datas) {
		this.datas = datas;
	}

	public void addData(T data) {
		datas.add(data);
	}

	public int getTotalPage() {
		return (int) ((this.getTotalCount() % pageSize == 0) ? (this.getTotalCount() / pageSize)
				: (this.getTotalCount() / pageSize + 1));
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	@Override
	public String toString() {
		return "SearchResult [totalCount=" + totalCount + ", totalPage=" + getTotalPage() + ", pageSize=" + pageSize
				+ "]";
	}
}
